Skip to content

enable select for update in autocommit mode#3265

Closed
demmer wants to merge 1 commit intovitessio:masterfrom
tinyspeck:allow-autocommit-select-for-update
Closed

enable select for update in autocommit mode#3265
demmer wants to merge 1 commit intovitessio:masterfrom
tinyspeck:allow-autocommit-select-for-update

Conversation

@demmer
Copy link
Copy Markdown
Member

@demmer demmer commented Sep 30, 2017

Add support for autocommit mode and select for update transactions
which is needed in cases where a DML is issued on a table with an
owned secondary vindex, since the vtgate will first issue a query
to get the index value from the primary row before trying to delete
it.

Add support for autocommit mode and select for update transactions
which is needed in cases where a DML is issued on a table with an
owned secondary vindex, since the vtgate will first issue a query
to get the index value from the primary row before trying to delete
it.
Copy link
Copy Markdown
Contributor

@sougou sougou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autocommit at vttablet level is deprecated (and highly discouraged). We introduced it to support certain v2 operations, but this totally fails for v3 operations that may have lookup updates, etc.

The v3 autocommit happens through the session object. Also, it's a common misunderstanding that select for update locks the row. In reality, no lock is obtained because the statement is immediately 'commited': https://dev.mysql.com/doc/refman/5.7/en/innodb-locking-reads.html,

@demmer
Copy link
Copy Markdown
Member Author

demmer commented Oct 1, 2017

Ah -- this makes much more sense and exposes a design flaw in the current vtexplain implementation. Will replace with a better approach.

@demmer demmer closed this Oct 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants